#ifndef PROXY_H
#define PROXY_H
#include "macro.h"
#ifdef __cplusplus
extern "C" {
#endif 
#pragma pack(push, 1)
    typedef struct CEvent { 
        int id; 
        char* payload;  // 指向动态分配的内存
        size_t payload_size;  // payload大小
    }CEvent;
#pragma pack(pop)
    EVENT_BUS_API void eb_push(const CEvent* e);

    EVENT_BUS_API int  eb_pop(CEvent* e);   // 1=success 0=empty
    
    // 新增函数：创建和销毁CEvent
    EVENT_BUS_API CEvent* eb_create_event(int id, const char* payload, size_t size);
    EVENT_BUS_API void eb_destroy_event(CEvent* e);
    
    // 新增函数：释放payload内存
    EVENT_BUS_API void eb_free_payload(char* payload);
    EVENT_BUS_API void start();
#ifdef __cplusplus
}
#endif

#endif // PROXY_H